home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16469 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.1 KB

  1. Path: news.uiowa.edu!usenet
  2. From: larued@crpl.cedar-rapids.lib.ia.us
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: IDEAS NEEDED!!, Saving Trees
  5. Date: 10 Apr 1996 23:59:22 GMT
  6. Organization: University of Iowa, Iowa City, IA, USA
  7. Distribution: world
  8. Message-ID: <4khi0q$vis@flood.weeg.uiowa.edu>
  9. References: <4kgasf$4eg@news.eng.octel.com>
  10. Reply-To: larued@crpl.cedar-rapids.lib.ia.us
  11. NNTP-Posting-Host: ppp-110.cedar-rapids.lib.ia.us
  12. X-Newsreader: IBM NewsReader/2 v1.9d - NLS
  13.  
  14. In <4kgasf$4eg@news.eng.octel.com>, wdengel@ibm.net (Wayne) writes:
  15. >Hello, and Help..
  16. >
  17. >I am looking for an easy (NOTHING COMPLICATED IS EASY) way to have a tree  with 
  18. >variant records as each node.  I need each node to have an unlimited number of 
  19. >branches.  I then would like to save the whole tree in ONE file.
  20. >
  21. >So:
  22. >    TREE
  23. >    Variant Record Size Nodes
  24. >    Unlimited Branches per Node
  25. >    Need to Save to ONE file.
  26. >
  27. >I know this can be done, but I don't want to write a whole garbage collection 
  28. >system and tree system is someone has already done this.
  29. >
  30. >I would like the NODES to be some sort of baseClass that I can use to 
  31. >virtualize the SAVE function for each node.  (A Node is an object.)
  32. >
  33. >If anybody has an IDEA, please post.
  34. >
  35. >Thanks for the help..
  36. >
  37. >Wayne D.
  38. >
  39.   This sounds simple enough.  I've been doing it for some time now.  My
  40. approach used the IBM C Set/2 Collection Classes.  It allows for sets and
  41. other tree structures.  I defined an abstract base type and a tree of
  42. the abstract base type.  Actually mine is more complicated but it could be
  43. generalized to be branch of (branches or leafs).  Most beginning C++ books
  44. show implementations of this.  Check out the C++ Algorythms Books.  Also
  45. define input and output routines for each node type.  I called mine build
  46. and parse.  They were similar to << and >> except that they allowed me extra
  47. flexibility for parameters.  I also have examples based on array 
  48. implementations.  It was for using tag/length/data files.  The runtime
  49. structures were edited by conventional class overrides.
  50.  
  51.   I'ld be glad to work with you email.  I don't have any quick eamples to 
  52. mail/post.
  53.  
  54.   Good luck,
  55.  
  56.   Dave LaRue
  57.   Team OS/2, ACM, IEEE
  58.